home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0705.dms / q0705.adf / Amiga / Appendices / FunctionsAndLibraries / TimerLibrary.doc < prev    next >
Text File  |  1992-07-29  |  3KB  |  91 lines

  1. 6    TIMER LIBRARY
  2.  
  3.  
  4. 6.1  OPEN THE TIMER LIBRARY
  5.  
  6. Before you may use the functions listed in this file you have
  7. to get access to the Timer Library. This library is only used
  8. together with the Timer Device and is therefore not opened as
  9. other normal libraries. Instead you only have to declare and
  10. initialize a global device pointer called "TimerDevice". This
  11. global pointer should be given the current address of the timer
  12. device. This address can be found in the "io_Device" field of
  13. the request block. (You must of course first open the timer
  14. device before you can find the address.)
  15.  
  16.   /* Declare a pointer to the Timer Device: */
  17.   struct Device *TimerBase;
  18.  
  19.   /* ... Create request blocks, open timer device etc ... */
  20.  
  21.   /* Get the global pointer to the timer device: */
  22.   TimerBase = timer_req->tr_node.io_Device;
  23.  
  24.  
  25.   /* ... */
  26.  
  27.  
  28.   /* Since you have not opened anything you */
  29.   /* do not have to close anything.         */
  30.  
  31.  
  32.  
  33. 6.2  FUNCTIONS
  34.  
  35. AddTime()
  36.  
  37.   This function is used to add the time in one timeval
  38.   structure with the time in another timeval structure.
  39.  
  40.   Synopsis: AddTime( tiem1, time2 );
  41.  
  42.   time1:    (struct timeval *) Pointer to the first timeval
  43.             structure. The value of the second timeval
  44.             structure will be added with this timeval
  45.             structure, and the result stored here.
  46.  
  47.   time1:    (struct timeval *) Pointer to the second timeval
  48.             structure.
  49.  
  50.  
  51.  
  52. CmpTime()
  53.  
  54.   This function is used to compare two timeval structures and
  55.   returns 0 if they were identical, -1 if the first timeval
  56.   structure was greater than the second, and 1 if the opposite
  57.   (the second timeval structure was greater than the first).
  58.  
  59.   Synopsis: dif = CmpTime( time1, time2 );
  60.  
  61.   dif:      (long) If the two time values were identical 0 is
  62.             returned. If the first time value was greater than
  63.             the second time value -1 is returned, and if the
  64.             opposite (the second time value is greater than the
  65.             first time value) 1 is returned.
  66.  
  67.   time1:    (struct timeval *) Pointer to the first timeval
  68.             structure.
  69.  
  70.   time1:    (struct timeval *) Pointer to the second timeval
  71.             structure.
  72.  
  73.  
  74.  
  75. SubTime()
  76.  
  77.   This function is used to subtract the time in one timeval
  78.   structure with the time in another timeval structure.
  79.  
  80.   Synopsos: SubTime( tiem1, time2 );
  81.  
  82.   time1:    (struct timeval *) Pointer to the first timeval
  83.             structure. The value of the second timeval
  84.             structure will be subtracted with this timeval
  85.             structure, and the result stored here.
  86.  
  87.   time1:    (struct timeval *) Pointer to the second timeval
  88.             structure.
  89.  
  90.  
  91.